package com.apts.validator;

import com.apts.jfinalbase.BaseJsonPojo;
import com.apts.jfinalbase.BaseValidator;
import com.apts.pojo.ErrorPojo;
import com.jfinal.core.Controller;
import com.jfinal.kit.StrKit;

public class DoLoginValidator extends BaseValidator {

	@Override
	protected void validate(Controller c) {
		System.out.println( "---------------------  DoLogin校验  ------------------------" );
		String account = c.getPara("account");
		String password = c.getPara("password");
		if( ! StrKit.notBlank(account, password) ){
			 this.addError("msg", "参数有误");
		}
	}

	@Override
	protected void handleError(Controller c) {
		BaseJsonPojo json = new ErrorPojo( c.getAttrForStr("msg") );
		c.renderJson( json );
	}

}
